package com.hxz.pojo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author 86199
 * @Date 2021/3/25 13:06
 */
public class MyBeanPostProcesser implements BeanPostProcessor {

    private MyBeanPostProcesser(){
        System.out.println("MyBeanPostProcesser构造器执行!");
    }

    @Override
    @Nullable
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("beanName的名字是：" + beanName + "，BeanPostProcessor的postProcessBeforeInitialization方法正在调用...");
        return bean;
    }

    @Override
    @Nullable
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("beanName的名字是：" + beanName + "，BeanPostProcessor的postProcessAfterInitialization方法正在调用...");

        return bean;
    }
}